package global

import (
	"gitee.com/youbeiwuhuan/gin-practice/gin-simple/global/conf"
	"gitee.com/youbeiwuhuan/gin-practice/gin-simple/pkg/gins"
	"gitee.com/youbeiwuhuan/gin-practice/gin-simple/pkg/zaps"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
	"strconv"
)

var (
	Config    conf.AppConfig
	ZapLog    *zap.Logger
	GinEngine *gin.Engine
)

func InitGlobal() {
	var file = conf.GetConfFile()
	Config = conf.Load(file)
	ZapLog := zaps.CreateZapFactory(Config.Zap, zaps.ZapLogHandler)

	GinEngine = gins.InitWebRouter(Config.GinCfg, ZapLog)

	GinEngine.Run(":" + strconv.Itoa(Config.GinCfg.Port))

}
